package com.dingyang.controller;

import com.dingyang.controller.base.BaseController;
import com.dingyang.entity.PublicDocuments;
import com.dingyang.service.PublicDocumentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Map;

/**
 * @Author 晚点再动心
 * @Date 2022/9/1
 *
 */
//设置审批文件为公开文件，让系统中所有用户都能看得到

@RestController
@RequestMapping("/public_documents")
public class PublicDocumentsController extends BaseController<PublicDocuments, PublicDocumentsService> {
    //
    /**
     *公开文件对象
     */
    @Autowired
    public PublicDocumentsController(PublicDocumentsService service) {
        setService(service);
    }

    @PostMapping("/add")
    @Transactional
    public Map<String, Object> add(HttpServletRequest request) throws IOException {
        Map<String,Object> paramMap = service.readBody(request.getReader());
        this.addMap(paramMap);
        return success(1);
    }

}